# GPL3 or any later version

import os

from modules import wallet_selector
from modules import main_window
from modules import images


# Selecting a wallet to work with
wallet = wallet_selector.select_wallet()

# If selected, launching a main window with the selected wallet.
if wallet:
    main_window.show_main_window(wallet)


# Making a Desktop Entry ( an applications menu entry ).

desktop = """[Desktop Entry]
Name=J.Y.Transactions
GenericName=Finance
Path="""+os.getcwd()+"""
Exec=python3 run.py
Icon="""+os.getcwd()+"""/icon_small.png
Terminal=false
Type=Application
Categories=Finance;Office;

"""
if os.path.exists(os.environ['HOME']+"/.local/share/applications") \
and not os.path.exists(os.environ['HOME']+"/.local/share/applications/JYTRANSACTIONS.desktop"):
    o = open(os.environ['HOME']+"/.local/share/applications/JYTRANSACTIONS.desktop", "w")
    o.write(desktop)
    o.close()
    print("Desktop Made!")


# Cleaning unessesary searched images.
    
images.clear()
